# Python readline()和readlines()函数：按行读取文件
file = open("my_file.txt")
# 读取一行数据
line = file.readline()
print(line)
# 关闭文件
file.close()

print()

# 以二进制形式打开指定文件
file = open("my_file.txt", "rb")
bytes = file.readline(6)
print(bytes)
# 关闭文件
file.close()

print()

file = open("my_file.txt", "rb")
bytes = file.readlines()
print(bytes)
# 关闭文件
file.close()
